﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 方法的重载
{
    class calcArea
    {
        //计算圆的面积
        public static double Area(double r)
        {
            double i = Math.PI * r * r;
            return (i);//方法有返回类型，必须用关键字return返回值，此处返回值类型为double类型
        }
        //计算矩形的面积
        public static double Area(double a, double b)
        {
            return (a * b);
        }
        //计算三角形的面积
        public static double Area(double a, double b, double c)
        {
            double l;
            l = (a + b + c) / 2;
            return (Math.Sqrt(l * (l - a) * (l - b) * (l - c)));
 
        }

    }
    class Program
    {

        static void Main(string[] args)
        {
            //calcArea a = new calcArea();
            double x = calcArea.Area(5);
            Console.WriteLine(x);
        }
    }
}
